package com.topvision.myviewtest.behavor;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.topvision.myviewtest.R;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;


public class BehaviorActivity extends AppCompatActivity {
    @BindView(R.id.behavior_recyclerview)
    RecyclerView mBehaviorRecyclerview;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_behavior);
        ButterKnife.bind(this);

        initView();
    }

    private void initView() {
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
        mBehaviorRecyclerview.setLayoutManager(linearLayoutManager);
        mBehaviorRecyclerview.setAdapter(new BehaviorAdapter(R.layout.layout_behavior_item,getDatas()));
    }

    private List<ItemBean> getDatas() {
        ArrayList<ItemBean> itemBeans = new ArrayList<>();
        for (int i = 0; i < 20; i++) {
            ItemBean bean = new ItemBean();
            bean.imageRes = R.mipmap.test_pic;
            bean.desc = "图片-->" + (1 + i);
            itemBeans.add(bean);
        }
        return itemBeans;
    }
}
